export default {
  methods: {
	getAppPosition() {
		uni.getLocation({
			type: 'gcj02',
			geocode: true,
			success: function(res) {
				console.log('**定位信息', res);
				uni.setStorageSync('location',res)
			},
			fail: function(err) {
				
			}
		});
		uni.setStorageSync('location',res)
	},
    toUrl(page,isAuth) {
		// if(isAuth && !uni.getStorageSync('userInfo')){
		// 	uni.navigateTo({
		// 		url:'/pages/login/login'
		// 	})
		// 	return;
		// }
		uni.navigateTo({
			url:page
		})
    },
	formatDate(timestamp,formatType){
		const date = new Date(timestamp * 1000);
		const year = date.getFullYear();
		const month = ("0" + (date.getMonth() + 1)).slice(-2);
		const day = ("0" + date.getDate()).slice(-2);
			
		let formattedDate = '';
			
		switch (formatType) {
			case 'YYYY年MM月DD日':
			  formattedDate = `${year}年${month}月${day}日`;
			  break;
			case 'MM/DD/YYYY':
			  formattedDate = `${month}/${day}/${year}`;
			  break;
			default:
			  formattedDate = `${year}-${month}-${day}`;
		}
			
		return formattedDate;		
	}
  },
}
